<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>博客管理</title>
	<meta name="decorator" content="default"/>
		 	<!-- 富文本编辑器 -->		 	
			<script type="text/javascript" src="${ctxStatic}/ueditor/ueditor.config.js"></script>
			<script type="text/javascript" src="${ctxStatic}/ueditor/ueditor.all.js"></script>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#content").val($("#rich_content").next().find(".note-editable").html());//取富文本的值
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
				//富文本初始化
				var ue = UE.getEditor('rich_content');
					laydate({
			            elem: '#createTime', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });
		});
	</script>
</head>
<body class="hideScroll">
		<form:form id="inputForm" modelAttribute="xBlog" action="${ctx}/xiongda/xBlog/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>

				<tr>
					<td class="width-15 active"><label class="pull-right">用户名：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.user.userName}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">分类名：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.category.name}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">标题：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.title}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">内容：</label></td>
					<td class="width-85">
						<form:textarea path="content" htmlEscape="false" id="rich_content" style="height:400px;" />
                        </div>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">创建时间：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;<fmt:formatDate value="${xBlog.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">更新时间：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;<fmt:formatDate value="${xBlog.updateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">修改次数：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.editCount}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">点赞：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.praise}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">浏览次数：</label></td>
					<td class="width-85">
						&nbsp;&nbsp;${xBlog.readCount}
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">背景样式：</label></td>
					<td class="width-85">
						<c:if test="${xBlog.backgroundStyle==0}">&nbsp;&nbsp;背景样式0</c:if>
						<c:if test="${xBlog.backgroundStyle==1}">&nbsp;&nbsp;背景样式1</c:if>
						<c:if test="${xBlog.backgroundStyle==2}">&nbsp;&nbsp;背景样式2</c:if>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">是否可评论：</label></td>
					<td class="width-85">
						<c:if test="${xBlog.isComment==0}">&nbsp;&nbsp;可评论</c:if>
						<c:if test="${xBlog.isComment==1}">&nbsp;&nbsp;不可评论</c:if>
					</td>
				</tr>

		 	</tbody>
		</table>
	</form:form>
</body>
</html>